package com.saleoffline.server.domain.sale;

import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.saleoffline.server.BaseObject;
import com.saleoffline.server.support.DateUtils;

public class Sale extends BaseObject {
	private int id;
	private int productId;
	private String productName;
	private Date saleDateFrom;
	private Date saleDateTo;
	private Date createDate;
	private String writerId;
	private String writerName;
	private int saleOffFrom;
	private int saleOffTo;
	private int shopId;
	private String shopName;
	private String shopTel;
	private String shopTelIdx;
	private String latitude;
	private String longitude;
	private int locationId;
	private String locationAddress;
	private String photoUrl1;
	private String photoUrl2;
	
	public String getDisplaySaleDateFrom() {
		return DateUtils.dateToString(saleDateFrom);
	}
	
	public String getDisplaySaleDateTo() {
		return DateUtils.dateToString(saleDateTo);
	}

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getProductId() {
		return productId;
	}
	public void setProductId(int productId) {
		this.productId = productId;
	}
	public String getProductName() {
		return productName;
	}
	public void setProductName(String productName) {
		this.productName = productName;
	}
	public Date getSaleDateFrom() {
		return saleDateFrom;
	}
	public void setSaleDateFrom(Date saleDateFrom) {
		this.saleDateFrom = saleDateFrom;
	}
	public Date getSaleDateTo() {
		return saleDateTo;
	}
	public void setSaleDateTo(Date saleDateTo) {
		this.saleDateTo = saleDateTo;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public String getWriterId() {
		return writerId;
	}
	public void setWriterId(String writerId) {
		this.writerId = writerId;
	}
	public String getWriterName() {
		return writerName;
	}
	public void setWriterName(String writerName) {
		this.writerName = writerName;
	}
	public int getSaleOffFrom() {
		return saleOffFrom;
	}
	public void setSaleOffFrom(int saleOffFrom) {
		this.saleOffFrom = saleOffFrom;
	}
	public int getSaleOffTo() {
		return saleOffTo;
	}
	public void setSaleOffTo(int saleOffTo) {
		this.saleOffTo = saleOffTo;
	}
	public int getShopId() {
		return shopId;
	}
	public void setShopId(int shopId) {
		this.shopId = shopId;
	}
	public String getShopName() {
		return shopName;
	}
	public void setShopName(String shopName) {
		this.shopName = shopName;
	}
	public String getShopTel() {
		return shopTel;
	}
	public void setShopTel(String shopTel) {
		this.shopTel = shopTel;
	}
	public String getShopTelIdx() {
		return shopTelIdx;
	}
	public void setShopTelIdx(String shopTelIdx) {
		this.shopTelIdx = shopTelIdx;
	}
	public String getLatitude() {
		return latitude;
	}
	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}
	public String getLongitude() {
		return longitude;
	}
	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}
	public int getLocationId() {
		return locationId;
	}
	public void setLocationId(int locationId) {
		this.locationId = locationId;
	}
	public String getLocationAddress() {
		return locationAddress;
	}
	public void setLocationAddress(String locationAddress) {
		this.locationAddress = locationAddress;
	}
	public String getPhotoUrl1() {
		if (StringUtils.isBlank(photoUrl1)) {
			return "http://jarang.iptime.org:8080/image/noimage.png";
		}
		return photoUrl1;
	}
	public void setPhotoUrl1(String photoUrl1) {
		this.photoUrl1 = photoUrl1;
	}
	public String getPhotoUrl2() {
		if (StringUtils.isBlank(photoUrl2)) {
			return "http://jarang.iptime.org:8080/image/noimage.png";
		}
		return photoUrl2;
	}
	public void setPhotoUrl2(String photoUrl2) {
		this.photoUrl2 = photoUrl2;
	}
}